<template>
  <!--  -->
  <!-- 文件预览：pdf文档预览） -->
  <!--  -->

  <div class="pdf">
    <vue-pdf-embed class="vue-pdf-embed" ref="pdfRef" :source="state.url" width="750" :page="state.pageNum"></vue-pdf-embed>
  </div>
</template>

<script setup>
import VuePdfEmbed from "vue-pdf-embed";     //pdf展示插件，依赖下载在package.json第29行
import { ref, reactive, getCurrentInstance, onMounted, computed, onUnmounted } from "vue";
const { proxy } = getCurrentInstance();

const props = defineProps({
    url: {
        type: String,
    },
});

const state = ref({
    url: "",
    pageNum: 0,
    numPages:0,
});


const initPdf = async () => {
    state.value.url = "/api" + props.url;
}


onMounted(() => {
    initPdf();
})

</script>

<style lang="scss" scoped>
.pdf {
    width: 100%;
}

</style>